package
{
	import com.bit101.components.Panel;
	
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.geom.Rectangle;
	
	import starling.core.Starling;
	import starling.events.Event;
	
	[SWF(frameRate="60",width="1800",height="800",backgroundColor="0xA6A2A4")]
	public class EffectEditor extends Sprite
	{
		private var _starling:Starling;
		
		private var _valuePanel:ValuePanel;
		
		public function EffectEditor()
		{
			addEventListener(flash.events.Event.ADDED_TO_STAGE,addToStage);
		}
		
		protected function addToStage(event:flash.events.Event):void
		{
			removeEventListener(flash.events.Event.ADDED_TO_STAGE,addToStage);
			_starling=new Starling(Game,stage,new Rectangle(300,0,Setting.WIDTH,Setting.HEIGHT-Setting.PANEL_HEIGHT));
			_starling.addEventListener(starling.events.Event.ROOT_CREATED,rootCreated);
			_starling.start();
		}
		
		private function rootCreated(e:starling.events.Event):void
		{
			var game:Game=e.data as Game;
			EditorModel.root=game;
			Setting.init(settingInitComplete);
		}
		private function settingInitComplete():void{
			_valuePanel=new ValuePanel();
			addChild(_valuePanel);
			_valuePanel.init();
		}
	}
}